<form class="form-horizontal" role="form" method="post" action="add" id="contractForm" style="padding-bottom: 70px">
    <input type="hidden" name="pid" value="<?= $pid?>">
    <div class="col-xs-12">
        <h4 class="header row smaller blue no-margin-top">基本信息</h4>
    </div>
    <div class="row">
        <div class="form-group">
            <label class="control-label col-xs-2"><b>*</b>编号</label>
            <div class="col-xs-8 col-md-4">
                <div>
                    <input type="text" name="code" class="form-control">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-2"><b>*</b>采购方</label>
            <div class="col-xs-8 col-md-5">
                <div class="input-group">
                    <input type="hidden" class="form-control" name="uid">
                    <input type="text" class="form-control" id="customer-input" readonly>
                    <span class="input-group-btn"><a href="#customer-table-modal" role="button" class="btn btn-success btn-sm" data-toggle="modal"> <i class="fa fa-users"></i> 选择 </a></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-2"><b>*</b>签约时间</label>
            <div class="col-xs-8 col-md-4">
                <div class="input-group">
                    <input class="form-control" name="sign_at" type="text">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-2">开始结束时间</label>
            <div class="col-xs-8 col-md-4">
                <div class="input-group">
                    <input class="form-control" name="start_over_at" type="text">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-2">总金额</label>
            <div class="col-xs-8 col-md-4">
                <div class="input-group">
                    <input class="form-control" name="total_fee" type="text">
                    <span class="input-group-addon">万元</span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-2">附件<span class="help-button" data-rel="popover" data-content="1.最大上传文件大小20M；<br>2.允许上传文件类型：pdf、docx、xls、png、jpg、jpeg。"data-html="true" data-original-title="提示信息">?</span></label>
            <div class="col-xs-2" style="width: 120px">
                <button class="btn btn-success btn-sm" id="attchmentPicker" type="button"><i class="fa fa-folder-open bigger-120"></i>选择文件</button>
            </div>
            <ul class="col-xs-6" id="contract-attachment-list"></ul>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-2">备注</label>
            <div class="col-xs-8 col-md-5">
                <textarea name="remark" class="form-control"></textarea>
            </div>
        </div>
        </div>
        <div class="col-xs-12">
            <h4 class="header row smaller blue no-margin-top">营养包</h4>
        </div>
    <div class="row">
        <div class="col-xs-12">
            <div class="form-group col-xs-4 no-padding-left">
                <select name="product_name" id="" class="form-control">
                    <option value="婴幼儿辅食营养包">婴幼儿辅食营养包</option>
                </select>
            </div>
            <div class="form-group col-xs-4">
                <select name="product_spec" id="" class="form-control">
                    <option value="">12g/袋*30袋/盒</option>
                </select>
            </div>
            <div class="form-group col-xs-2">
                <div>
                    <input type="text" name="product_amount" class="form-control" placeholder="数量">
                </div>
            </div>
            <div class="form-group col-xs-2 no-padding-right">
                <select name="product_unit" class="form-control">
                    <option value="盒">盒</option>
                    <option value="袋">袋</option>
                </select>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <h4 class="row header smaller blue no-margin-top no-margin-left no-margin-right">
                <span class="col-sm-8 no-padding-left">配套物资</span>
                <span class="col-sm-4 no-padding-right"><button type="button" onclick="addMaterial()" class="btn pull-right btn-xs btn-success"><i class="fa fa-plus"></i> 新增</button></span>
            </h4>
        </div>
        <div class="col-xs-12">
            <table class="table table-bordered" id="material-list" style="margin-bottom: 0">
                <tr style="background-color: #f5f5f5">
                    <th style="padding: 6px">名称</th>
                    <th style="width: 150px">品牌</th>
                    <th>规格</th>
                    <th style="width: 120px">数量</th>
                    <th style="width: 200px">单位</th>
                    <th style="width: 150px">备注</th>
                    <th style="width: 60px">操作</th>
                </tr>
                <tr class="material-empty">
                    <td colspan="6" style="text-align: center;color: grey">点击右上角新增添加合同配套物资</td>
                </tr>
            </table>
        </div>
    </div>
    <div class="form-actions fixed-bottom">
        <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-remove"></i> 取消</button>
        <button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> 提交</button>
    </div>
</form>
<script type="text/html" id="material-item-tpl">
    <tr class="material-item">
        <td><textarea type="text" name="product_extra_name[]" class="form-control" style="height: 34px"></textarea></td>
        <td><textarea type="text" name="product_extra_brand[]" class="form-control" style="height: 34px"></textarea></td>
        <td><textarea type="text" name="product_extra_spec[]" class="form-control" style="height: 34px"></textarea></td>
        <td>
            <div class="form-group no-margin-bottom">
                <div>
                    <input type="text" name="product_extra_amount[]" style="width: 120px;height: 34px">
                </div>
            </div>
        </td>
        <td>
            <select name="product_extra_unit_sel[]" id="" style="width: 90px;">
                <option value="">选择单位</option>
                <?php foreach (Yii::$app->params['product_extra_units'] as $v):?>
                <option value="<?= $v?>"><?= $v?></option>
                <?php endforeach;?>
            </select>
            <input type="text" name="product_extra_unit[]" style="width: 85px;height: 34px" placeholder="自定义单位">
        </td>
        <td><textarea type="text" name="product_extra_remark[]" class="form-control" style="height: 34px"></textarea></td>
        <td><button type="button" class="btn btn-danger btn-xs remove-material">删除</button></td>
    </tr>
</script>
<?=
$this->render('tpls/customers');
?>
<?php $this->beginBlock('js') ?>
<script src="<?= Yii::$app->params['static_domain']?>plugin/webuploader/dist/webuploader.js"></script>
<script src="/js/pages/contract_form.js?v=<?= time()?>"></script>
<?php $this->endBlock() ?>
